package com.melesta.engine;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.backup.BackupManager;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.Html;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.Toast;
import com.amazon.ags.api.AGResponseCallback;
import com.amazon.ags.api.AGResponseHandle;
import com.amazon.ags.api.AmazonGames;
import com.amazon.ags.api.AmazonGamesCallback;
import com.amazon.ags.api.AmazonGamesClient;
import com.amazon.ags.api.AmazonGamesFeature;
import com.amazon.ags.api.AmazonGamesStatus;
import com.amazon.ags.api.ErrorCode;
import com.amazon.ags.api.RequestResponse;
import com.amazon.ags.api.achievements.AchievementsClient;
import com.amazon.ags.api.achievements.UpdateProgressResponse;
import com.amazon.ags.api.leaderboards.LeaderboardsClient;
import com.amazon.ags.api.leaderboards.SubmitScoreResponse;
import com.amazon.ags.api.whispersync.RevertBlobCallback;
import com.amazon.ags.api.whispersync.SynchronizeBlobCallback;
import com.amazon.ags.api.whispersync.SynchronizeBlobProgressRequest;
import com.amazon.ags.api.whispersync.SynchronizeBlobRequest;
import com.amazon.ags.api.whispersync.WhisperSyncClient;
import com.amazon.ags.constants.whispersync.ConflictStrategy;
import com.burstly.lib.conveniencelayer.Burstly;
import com.chartboost.sdk.Chartboost;
import com.facebook.Session;
import com.facebook.Session.NewPermissionsRequest;
import com.facebook.Session.StatusCallback;
import com.facebook.SessionState;
import com.facebook.UiLifecycleHelper;
import com.flurry.android.FlurryAgent;
import com.melesta.ads.BurstlyAnimatedBanner;
import com.melesta.engine.amazon.WhispersyncBlobCallback;
import com.melesta.engine.sponsorpay.SPNativeDelegate;
import com.melesta.expansions.ActivityState;
import com.melesta.expansions.ExpansionsManager;
import com.melesta.payment.PaymentExpansion;
import com.melesta.payment.PaymentManager;
import com.melesta.payment.PaymentTransaction;
import com.mobileapptracker.MobileAppTracker;
import com.sponsorpay.sdk.android.SponsorPay;
import com.sponsorpay.sdk.android.credentials.SPCredentials;
import com.sponsorpay.sdk.android.publisher.SponsorPayPublisher;
import com.sponsorpay.sdk.android.publisher.currency.CurrencyServerAbstractResponse;
import com.sponsorpay.sdk.android.publisher.currency.CurrencyServerDeltaOfCoinsResponse;
import com.sponsorpay.sdk.android.publisher.currency.SPCurrencyServerListener;
import com.sponsorpay.sdk.android.publisher.currency.VirtualCurrencyConnector;
import com.tapjoy.TapjoyConnect;
import com.tapjoy.TapjoyEarnedPointsNotifier;
import com.tapjoy.TapjoyNotifier;
import com.tapjoy.TapjoySpendPointsNotifier;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpProtocolParams;
import org.json.JSONObject;

@SuppressLint({"DefaultLocale"})
public class EngineActivity extends Activity
  implements TapjoyEarnedPointsNotifier
{
  public static final int FB_OS_FAILURE = 1;
  public static final int FB_OS_SUCCESS = 0;
  private static final String PREF_BACKUP_NAME = "BackupName";
  private static final String PREF_BACKUP_TIME = "BackupTime";
  private static final String PREF_SPONSORPAY_COINS = "SponsorPayCoins";
  private static final int SEND_EMAIL = 101;
  private static EngineActivity instance;
  private static final TrustManager mEasyTrustManager;
  private static boolean mIsTapjoyRefreshEarnedCurrencyRequestRunning;
  protected static String mPromoCodeUrl;
  private static TrustManager[] mTrustManagers = arrayOfTrustManager;
  protected static SynchronizeBlobCallback mWhispersyncBlobCallback = new WhispersyncBlobCallback();
  private boolean agcEnabled;
  AmazonGamesCallback agsGameCallback = new AmazonGamesCallback()
  {
    public void onServiceNotReady(AmazonGamesStatus paramAnonymousAmazonGamesStatus)
    {
      Log.d("amazonGC", paramAnonymousAmazonGamesStatus.toString());
      switch (EngineActivity.25.$SwitchMap$com$amazon$ags$api$AmazonGamesStatus[paramAnonymousAmazonGamesStatus.ordinal()])
      {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
      }
    }

    public void onServiceReady()
    {
      EngineActivity localEngineActivity = EngineActivity.getInstance();
      if (localEngineActivity == null)
        return;
      localEngineActivity.mHandler.post(new Runnable()
      {
        public void run()
        {
          try
          {
            Log.d("amazonGC", "ready");
            WhisperSyncClient localWhisperSyncClient = AmazonGamesClient.getInstance().getWhisperSyncClient();
            SynchronizeBlobRequest localSynchronizeBlobRequest = new SynchronizeBlobRequest(EngineActivity.mWhispersyncBlobCallback);
            localSynchronizeBlobRequest.setConflictStrategy(ConflictStrategy.AUTO_RESOLVE_TO_CLOUD);
            localWhisperSyncClient.synchronize(localSynchronizeBlobRequest);
            return;
          }
          catch (Exception localException)
          {
            Error.processException(localException);
          }
        }
      });
    }
  };
  private AmazonGames agsGameClient;
  private EnumSet<AmazonGamesFeature> agsGameFeatures = null;
  private final Session.StatusCallback facebookStatusCallback = new SessionStatusCallback(0, 0);
  private final List<ActivityTickListener> listeners = new ArrayList();
  private BurstlyAnimatedBanner mBanner;
  private Chartboost mChartboost;
  protected String mFacebookUserId;
  private String mFlurryApiKey;
  private RelativeLayout mFramelayout;
  private EngineGLSurfaceView mGLSurfaceView;
  final Handler mHandler = new Handler();
  private String mLanguage;
  private String mLastBackupName;
  private long mLastBackupTime;
  private RelativeLayout mProgressFramelayout;
  private Renderer mRenderer;
  private UiLifecycleHelper mUiHelper;
  private int mailId = -1;
  private MobileAppTracker mobileAppTracker = null;

  static
  {
    mIsTapjoyRefreshEarnedCurrencyRequestRunning = false;
    mEasyTrustManager = new X509TrustManager()
    {
      public void checkClientTrusted(X509Certificate[] paramAnonymousArrayOfX509Certificate, String paramAnonymousString)
        throws CertificateException
      {
      }

      public void checkServerTrusted(X509Certificate[] paramAnonymousArrayOfX509Certificate, String paramAnonymousString)
        throws CertificateException
      {
      }

      public X509Certificate[] getAcceptedIssuers()
      {
        return null;
      }
    };
    TrustManager[] arrayOfTrustManager = new TrustManager[1];
    arrayOfTrustManager[0] = mEasyTrustManager;
  }

  private static void backupBytes(DataOutputStream paramDataOutputStream, byte[] paramArrayOfByte)
    throws IOException
  {
    if (paramArrayOfByte != null)
    {
      paramDataOutputStream.writeInt(paramArrayOfByte.length);
      paramDataOutputStream.write(paramArrayOfByte);
      return;
    }
    paramDataOutputStream.writeInt(0);
  }

  private static boolean canPostPromoCode()
  {
    return (mPromoCodeUrl != null) && (mPromoCodeUrl.length() > 0);
  }

  public static boolean chartboostShowInterstitial(String paramString)
  {
    boolean bool1 = false;
    try
    {
      EngineActivity localEngineActivity = getInstance();
      if (localEngineActivity == null)
        return false;
      Chartboost localChartboost = localEngineActivity.mChartboost;
      if (localChartboost == null)
        return false;
      bool1 = false;
      if (paramString == null)
      {
        boolean bool2 = localChartboost.hasCachedInterstitial();
        bool1 = false;
        if (bool2)
        {
          localChartboost.showInterstitial();
          bool1 = true;
        }
        localChartboost.cacheInterstitial();
      }
      else
      {
        boolean bool3 = localChartboost.hasCachedInterstitial(paramString);
        bool1 = false;
        if (bool3)
        {
          localChartboost.showInterstitial(paramString);
          bool1 = true;
        }
        localChartboost.cacheInterstitial(paramString);
      }
    }
    catch (Exception localException)
    {
      Error.processException("chartboostShowInterstitial", localException);
    }
    return bool1;
  }

  private void checkMessage(Intent paramIntent)
  {
    if (paramIntent != null)
    {
      if (!paramIntent.hasExtra("PUSH_RECEIVE_EVENT"))
        break label46;
      showToast("push message is " + paramIntent.getExtras().getString("PUSH_RECEIVE_EVENT"));
    }
    label46: 
    do
    {
      return;
      if (paramIntent.hasExtra("REGISTER_EVENT"))
      {
        showToast("register");
        return;
      }
      if (paramIntent.hasExtra("UNREGISTER_EVENT"))
      {
        showToast("unregister");
        return;
      }
      if (paramIntent.hasExtra("REGISTER_ERROR_EVENT"))
      {
        showToast("register error");
        return;
      }
    }
    while (!paramIntent.hasExtra("UNREGISTER_ERROR_EVENT"));
    showToast("unregister error");
  }

  public static void checkPromocode(final String paramString)
  {
    EngineActivity localEngineActivity = getInstance();
    localEngineActivity.showWaitScreen(true);
    Thread localThread = new Thread(new Runnable()
    {
      public void run()
      {
        int i = 1;
        try
        {
          String str1 = this.val$ea.getUserEmail();
          String str2 = this.val$ea.postPromocodeRequest(null, str1, paramString);
          JSONObject localJSONObject;
          if (str2 != null)
          {
            Log.d("checkPromocode", str2);
            localJSONObject = new JSONObject(str2);
            int k = localJSONObject.getInt("rs");
            if (k != 1)
              break label96;
            i = 0;
          }
          while (true)
          {
            this.val$ea.showWaitScreen(false);
            final int j = i;
            this.val$ea.runOnGLThread(new Runnable()
            {
              public void run()
              {
                try
                {
                  NativeEngineCallbacks.promocodeChecked(j);
                  return;
                }
                catch (Exception localException)
                {
                  Error.processException(localException);
                }
              }
            });
            return;
            label96: int m = localJSONObject.getInt("errorCode");
            if (m == 3)
              i = 0;
          }
        }
        catch (Exception localException)
        {
          while (true)
          {
            i = 2;
            Error.processException(localException);
            this.val$ea.showWaitScreen(false);
          }
        }
        finally
        {
          this.val$ea.showWaitScreen(false);
        }
      }
    });
    localThread.setName("postPromo");
    localThread.start();
  }

  public static void enableSleep(boolean paramBoolean)
  {
    if (getInstance() == null);
    final Window localWindow;
    do
    {
      return;
      localWindow = getInstance().getWindow();
    }
    while (localWindow == null);
    getInstance().runOnUiThread(new Runnable()
    {
      public void run()
      {
        if (this.val$enable)
        {
          localWindow.clearFlags(128);
          return;
        }
        localWindow.addFlags(128);
      }
    });
  }

  public static void exit()
  {
    try
    {
      getInstance().finish();
      System.runFinalizersOnExit(true);
      System.exit(0);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("exit()", localException);
    }
  }

  public static void facebookGetGroupInfo(String paramString, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookGetGroupInfo(paramString, paramInt1, paramInt2);
  }

  public static void facebookGetUserFriends(String paramString, int paramInt1, int paramInt2)
  {
    FacebookOperations.getUserFriends(paramString, paramInt1, paramInt2);
  }

  public static void facebookGetUserGameFriends(String paramString, int paramInt1, int paramInt2)
  {
    FacebookOperations.getUserGameFriends(paramString, paramInt1, paramInt2);
  }

  public static void facebookGetUserInfo(String paramString, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookGetUserInfo(paramString, paramInt1, paramInt2);
  }

  public static void facebookInviteUsersInGame(String paramString1, String paramString2, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookInviteUsersInGame(paramString1, paramString2, paramInt1, paramInt2);
  }

  public static void facebookIsUserLikedGroup(String paramString1, String paramString2, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookIsUserLikedGroup(paramString1, paramString2, paramInt1, paramInt2);
  }

  public static void facebookLike()
  {
    FacebookOperations.facebookLike();
  }

  public static void facebookLogin(int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookLogin(paramInt1, paramInt2);
  }

  public static void facebookPost(String paramString, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookPost(paramString, paramInt1, paramInt2);
  }

  public static void facebookReceiveNotify(int paramInt1, int paramInt2)
  {
    FacebookOperations.receiveNotify(paramInt1, paramInt2);
  }

  public static void facebookSendRequest(String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookSendRequest(paramString1, paramString2, paramString3, paramBoolean, paramInt1, paramInt2);
  }

  public static void facebookSendRequestToFriends(String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt1, int paramInt2)
  {
    FacebookOperations.facebookSendRequestToFriends(paramString1, paramString2, paramString3, paramBoolean, paramInt1, paramInt2);
  }

  public static void facebookSetUserScore(String paramString, int paramInt1, int paramInt2, int paramInt3)
  {
    FacebookOperations.facebookSetUserScore(paramString, paramInt1, paramInt2, paramInt3);
  }

  private void fireActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    try
    {
      ExpansionsManager.getInstance(this).fireActivityResult(this, paramInt1, paramInt2, paramIntent);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("fireActivityStateChange", localException);
    }
  }

  private void fireActivityStateChange(ActivityState paramActivityState)
  {
    try
    {
      ExpansionsManager.getInstance(this).fireActivityStateChange(paramActivityState, this, this.mHandler);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("fireActivityStateChange", localException);
    }
  }

  // ERROR //
  static void fireBeginTick()
  {
    // Byte code:
    //   0: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   3: ifnull +72 -> 75
    //   6: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   9: getfield 102	com/melesta/engine/EngineActivity:listeners	Ljava/util/List;
    //   12: astore_1
    //   13: aload_1
    //   14: monitorenter
    //   15: new 99	java/util/ArrayList
    //   18: dup
    //   19: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   22: getfield 102	com/melesta/engine/EngineActivity:listeners	Ljava/util/List;
    //   25: invokespecial 412	java/util/ArrayList:<init>	(Ljava/util/Collection;)V
    //   28: astore_2
    //   29: aload_1
    //   30: monitorexit
    //   31: aload_2
    //   32: invokeinterface 418 1 0
    //   37: astore 4
    //   39: aload 4
    //   41: invokeinterface 423 1 0
    //   46: ifeq +29 -> 75
    //   49: aload 4
    //   51: invokeinterface 427 1 0
    //   56: checkcast 429	com/melesta/engine/EngineActivity$ActivityTickListener
    //   59: invokeinterface 432 1 0
    //   64: goto -25 -> 39
    //   67: astore_0
    //   68: ldc_w 433
    //   71: aload_0
    //   72: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   75: return
    //   76: astore_3
    //   77: aload_1
    //   78: monitorexit
    //   79: aload_3
    //   80: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   6	15	67	java/lang/Exception
    //   31	39	67	java/lang/Exception
    //   39	64	67	java/lang/Exception
    //   79	81	67	java/lang/Exception
    //   15	31	76	finally
    //   77	79	76	finally
  }

  // ERROR //
  static void fireEndTick()
  {
    // Byte code:
    //   0: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   3: ifnonnull +4 -> 7
    //   6: return
    //   7: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   10: getfield 102	com/melesta/engine/EngineActivity:listeners	Ljava/util/List;
    //   13: astore_1
    //   14: aload_1
    //   15: monitorenter
    //   16: new 99	java/util/ArrayList
    //   19: dup
    //   20: getstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   23: getfield 102	com/melesta/engine/EngineActivity:listeners	Ljava/util/List;
    //   26: invokespecial 412	java/util/ArrayList:<init>	(Ljava/util/Collection;)V
    //   29: astore_2
    //   30: aload_1
    //   31: monitorexit
    //   32: aload_2
    //   33: invokeinterface 418 1 0
    //   38: astore 4
    //   40: aload 4
    //   42: invokeinterface 423 1 0
    //   47: ifeq -41 -> 6
    //   50: aload 4
    //   52: invokeinterface 427 1 0
    //   57: checkcast 429	com/melesta/engine/EngineActivity$ActivityTickListener
    //   60: invokeinterface 437 1 0
    //   65: goto -25 -> 40
    //   68: astore_0
    //   69: ldc_w 438
    //   72: aload_0
    //   73: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   76: return
    //   77: astore_3
    //   78: aload_1
    //   79: monitorexit
    //   80: aload_3
    //   81: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   7	16	68	java/lang/Exception
    //   32	40	68	java/lang/Exception
    //   40	65	68	java/lang/Exception
    //   80	82	68	java/lang/Exception
    //   16	32	77	finally
    //   78	80	77	finally
  }

  public static void flurryEndLogTimedEvent(String paramString)
  {
    try
    {
      FlurryAgent.endTimedEvent(paramString);
      return;
    }
    catch (Exception localException)
    {
      Error.processException(String.format("flurryLogEvent(%s)", new Object[] { paramString }), localException);
    }
  }

  public static void flurryLogEvent(String paramString, boolean paramBoolean)
  {
    try
    {
      FlurryAgent.logEvent(paramString, paramBoolean);
      return;
    }
    catch (Exception localException)
    {
      Error.processException(String.format("flurryLogEvent(%s)", new Object[] { paramString }), localException);
    }
  }

  public static void flurryLogEvent(String paramString, boolean paramBoolean, Object[] paramArrayOfObject)
  {
    try
    {
      HashMap localHashMap = new HashMap();
      StringBuffer localStringBuffer = new StringBuffer();
      for (int i = 0; i < paramArrayOfObject.length; i += 2)
      {
        localHashMap.put(paramArrayOfObject[i].toString(), paramArrayOfObject[(i + 1)].toString());
        if (localStringBuffer.length() > 0)
          localStringBuffer.append(" | ");
        localStringBuffer.append(paramArrayOfObject[i].toString()).append(':').append(paramArrayOfObject[(i + 1)].toString());
      }
      FlurryAgent.logEvent(paramString, localHashMap, paramBoolean);
      return;
    }
    catch (Exception localException)
    {
      Error.processException(String.format("flurryLogEvent(%s)", new Object[] { paramString }), localException);
    }
  }

  private String getBackupName()
  {
    boolean bool = this.agcEnabled;
    String str = null;
    if (bool)
      str = NativeEngineCallbacks.getGameBackupName();
    return str;
  }

  public static String getCurrentLanguage()
  {
    return getInstance().mLanguage;
  }

  public static EngineActivity getInstance()
  {
    if (instance == null)
      Log.d("e", "e");
    return instance;
  }

  private HttpClient getNewHttpClient()
  {
    try
    {
      KeyStore localKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
      localKeyStore.load(null, null);
      MySSLSocketFactory localMySSLSocketFactory = new MySSLSocketFactory(localKeyStore);
      localMySSLSocketFactory.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
      BasicHttpParams localBasicHttpParams = new BasicHttpParams();
      HttpProtocolParams.setVersion(localBasicHttpParams, HttpVersion.HTTP_1_1);
      HttpProtocolParams.setContentCharset(localBasicHttpParams, "UTF-8");
      HttpConnectionParams.setConnectionTimeout(localBasicHttpParams, 3000);
      SchemeRegistry localSchemeRegistry = new SchemeRegistry();
      localSchemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
      localSchemeRegistry.register(new Scheme("https", localMySSLSocketFactory, 443));
      DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(localBasicHttpParams, localSchemeRegistry), localBasicHttpParams);
      return localDefaultHttpClient;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
    return new DefaultHttpClient();
  }

  protected static String getPromocode()
  {
    String str = NativeEngineCallbacks.getGamePromocode();
    if ((str != null) && (str.length() > 0))
      return str;
    return "0013TDI";
  }

  private String getSoftwareVersion()
  {
    try
    {
      PackageInfo localPackageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
      String str = localPackageInfo.versionName + "." + localPackageInfo.versionCode;
      return str;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      Log.e("engine", "Package name not found", localNameNotFoundException);
    }
    return "";
  }

  private String getUserEmail()
  {
    for (Account localAccount : ((AccountManager)getSystemService("account")).getAccounts())
      if (localAccount.type.equalsIgnoreCase("com.google"))
        return localAccount.name;
    return "";
  }

  public static void hideBanner()
  {
    EngineActivity localEngineActivity = getInstance();
    if (localEngineActivity == null);
    while (localEngineActivity.mBanner == null)
      return;
    localEngineActivity.runOnUiThread(new Runnable()
    {
      public void run()
      {
        try
        {
          View localView = this.val$me.findViewById(R.id.burstly_bannerview);
          if (localView != null)
            localView.setVisibility(4);
          return;
        }
        catch (Exception localException)
        {
          Error.processException(localException);
        }
      }
    });
  }

  public static void openUrl(String paramString)
  {
    try
    {
      if ((!paramString.startsWith("http://")) && (!paramString.startsWith("https://")) && (!paramString.startsWith("market://")))
        paramString = "http://" + paramString;
      Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse(paramString));
      getInstance().startActivity(localIntent);
      return;
    }
    catch (Exception localException)
    {
      FlurryAgent.onError("openUrl", localException.toString(), "EngineActivity");
    }
  }

  private static void postPromoCode(PaymentTransaction paramPaymentTransaction)
  {
    if (!canPostPromoCode())
      return;
    new Thread(new Runnable()
    {
      public void run()
      {
        try
        {
          EngineActivity localEngineActivity = EngineActivity.getInstance();
          String str = localEngineActivity.getUserEmail();
          localEngineActivity.postPromocodeRequest(this.val$pt.paymentId, str, this.val$promocode);
          return;
        }
        catch (Exception localException)
        {
          Error.processException("sendPromo", localException);
        }
      }
    }
    , "SP-Thread").start();
  }

  // ERROR //
  private String postPromocodeRequest(String paramString1, String paramString2, String paramString3)
  {
    // Byte code:
    //   0: getstatic 201	com/melesta/engine/EngineActivity:mPromoCodeUrl	Ljava/lang/String;
    //   3: ifnull +233 -> 236
    //   6: getstatic 201	com/melesta/engine/EngineActivity:mPromoCodeUrl	Ljava/lang/String;
    //   9: invokevirtual 207	java/lang/String:length	()I
    //   12: ifne +6 -> 18
    //   15: goto +221 -> 236
    //   18: ldc_w 716
    //   21: invokestatic 721	javax/net/ssl/SSLContext:getInstance	(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;
    //   24: astore 5
    //   26: aload 5
    //   28: aconst_null
    //   29: getstatic 94	com/melesta/engine/EngineActivity:mTrustManagers	[Ljavax/net/ssl/TrustManager;
    //   32: aconst_null
    //   33: invokevirtual 725	javax/net/ssl/SSLContext:init	([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V
    //   36: aload 5
    //   38: invokevirtual 728	javax/net/ssl/SSLContext:getSocketFactory	()Ljavax/net/ssl/SSLSocketFactory;
    //   41: invokestatic 734	javax/net/ssl/HttpsURLConnection:setDefaultSSLSocketFactory	(Ljavax/net/ssl/SSLSocketFactory;)V
    //   44: invokestatic 215	com/melesta/engine/EngineActivity:getInstance	()Lcom/melesta/engine/EngineActivity;
    //   47: invokespecial 736	com/melesta/engine/EngineActivity:getNewHttpClient	()Lorg/apache/http/client/HttpClient;
    //   50: astore 6
    //   52: new 738	org/apache/http/client/methods/HttpPost
    //   55: dup
    //   56: getstatic 201	com/melesta/engine/EngineActivity:mPromoCodeUrl	Ljava/lang/String;
    //   59: invokespecial 740	org/apache/http/client/methods/HttpPost:<init>	(Ljava/lang/String;)V
    //   62: astore 7
    //   64: new 99	java/util/ArrayList
    //   67: dup
    //   68: iconst_4
    //   69: invokespecial 742	java/util/ArrayList:<init>	(I)V
    //   72: astore 8
    //   74: aload 8
    //   76: new 744	org/apache/http/message/BasicNameValuePair
    //   79: dup
    //   80: ldc_w 746
    //   83: aload_3
    //   84: invokespecial 748	org/apache/http/message/BasicNameValuePair:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   87: invokeinterface 752 2 0
    //   92: pop
    //   93: aload 8
    //   95: new 744	org/apache/http/message/BasicNameValuePair
    //   98: dup
    //   99: ldc_w 754
    //   102: aload_2
    //   103: invokespecial 748	org/apache/http/message/BasicNameValuePair:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   106: invokeinterface 752 2 0
    //   111: pop
    //   112: aload 8
    //   114: new 744	org/apache/http/message/BasicNameValuePair
    //   117: dup
    //   118: ldc_w 756
    //   121: aload_0
    //   122: invokevirtual 609	com/melesta/engine/EngineActivity:getPackageName	()Ljava/lang/String;
    //   125: invokespecial 748	org/apache/http/message/BasicNameValuePair:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   128: invokeinterface 752 2 0
    //   133: pop
    //   134: aload_1
    //   135: ifnull +29 -> 164
    //   138: aload_1
    //   139: invokevirtual 207	java/lang/String:length	()I
    //   142: ifle +22 -> 164
    //   145: aload 8
    //   147: new 744	org/apache/http/message/BasicNameValuePair
    //   150: dup
    //   151: ldc_w 758
    //   154: aload_1
    //   155: invokespecial 748	org/apache/http/message/BasicNameValuePair:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   158: invokeinterface 752 2 0
    //   163: pop
    //   164: aload 7
    //   166: new 760	org/apache/http/client/entity/UrlEncodedFormEntity
    //   169: dup
    //   170: aload 8
    //   172: invokespecial 763	org/apache/http/client/entity/UrlEncodedFormEntity:<init>	(Ljava/util/List;)V
    //   175: invokevirtual 767	org/apache/http/client/methods/HttpPost:setEntity	(Lorg/apache/http/HttpEntity;)V
    //   178: aload 6
    //   180: aload 7
    //   182: invokeinterface 773 2 0
    //   187: invokeinterface 779 1 0
    //   192: astore 14
    //   194: aload 14
    //   196: ifnull +33 -> 229
    //   199: aload 14
    //   201: invokestatic 784	org/apache/http/util/EntityUtils:toString	(Lorg/apache/http/HttpEntity;)Ljava/lang/String;
    //   204: astore 15
    //   206: ldc_w 630
    //   209: aload 15
    //   211: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   214: aload 15
    //   216: areturn
    //   217: astore 10
    //   219: aload 10
    //   221: athrow
    //   222: astore 4
    //   224: aload 4
    //   226: invokestatic 592	com/melesta/engine/Error:processException	(Ljava/lang/Exception;)V
    //   229: aconst_null
    //   230: areturn
    //   231: astore 9
    //   233: aload 9
    //   235: athrow
    //   236: aconst_null
    //   237: areturn
    //
    // Exception table:
    //   from	to	target	type
    //   64	134	217	org/apache/http/client/ClientProtocolException
    //   138	164	217	org/apache/http/client/ClientProtocolException
    //   164	194	217	org/apache/http/client/ClientProtocolException
    //   199	214	217	org/apache/http/client/ClientProtocolException
    //   0	15	222	java/lang/Exception
    //   18	64	222	java/lang/Exception
    //   64	134	222	java/lang/Exception
    //   138	164	222	java/lang/Exception
    //   164	194	222	java/lang/Exception
    //   199	214	222	java/lang/Exception
    //   219	222	222	java/lang/Exception
    //   233	236	222	java/lang/Exception
    //   64	134	231	java/io/IOException
    //   138	164	231	java/io/IOException
    //   164	194	231	java/io/IOException
    //   199	214	231	java/io/IOException
  }

  public static void purchaseProcessed(final long paramLong)
  {
    try
    {
      Log.d("engine", "purchaseProcessed");
      final DatabaseHelper localDatabaseHelper = DatabaseHelper.getHelper(getInstance());
      PaymentTransaction localPaymentTransaction = localDatabaseHelper.getTransaction(paramLong);
      if (localPaymentTransaction == null)
      {
        Log.d("engine", "error 1209");
        return;
      }
      getInstance().runOnUiThread(new Runnable()
      {
        public void run()
        {
          try
          {
            if (EngineActivity.access$800())
              EngineActivity.postPromoCode(this.val$pt);
            this.val$pt.processingTime = System.currentTimeMillis();
            localDatabaseHelper.saveTransaction(paramLong, this.val$pt);
            PaymentManager.getInstance().purchaseProcessed(this.val$pt);
            return;
          }
          catch (Exception localException)
          {
            Error.processException(localException);
          }
        }
      });
      return;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  public static void resetAmazonGameCircleProgress()
  {
    EngineActivity localEngineActivity = getInstance();
    if (localEngineActivity == null);
    while (true)
    {
      return;
      if (localEngineActivity.agcEnabled)
      {
        AchievementsClient localAchievementsClient = localEngineActivity.agsGameClient.getAchievementsClient();
        Iterator localIterator = AwardsHelper.getHelper().getAchievementsIds().iterator();
        while (localIterator.hasNext())
          localAchievementsClient.resetAchievement((String)localIterator.next(), new Object[0]).setCallback(new AGResponseCallback()
          {
            public void onComplete(RequestResponse paramAnonymousRequestResponse)
            {
              Log.d("GC", paramAnonymousRequestResponse.toString());
            }
          });
      }
    }
  }

  public static boolean restoreAll(byte[] paramArrayOfByte)
  {
    Log.d("engine", "restore all");
    boolean bool = DbBackup.restoreAll(DatabaseHelper.getHelper(getInstance()), paramArrayOfByte);
    if (bool)
      getInstance().reloadProfile();
    return bool;
  }

  private void runBackup()
  {
    try
    {
      if (DatabaseHelper.getHelper(this).getDbModificationTime() <= this.mLastBackupTime)
        return;
      this.mLastBackupTime = new Date().getTime();
      runBackup(getBackupName());
      return;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  public static void runBackup(String paramString)
  {
    while (true)
    {
      EngineActivity localEngineActivity;
      try
      {
        localEngineActivity = getInstance();
        DatabaseHelper localDatabaseHelper = DatabaseHelper.getHelper(localEngineActivity);
        if ((localEngineActivity.mLastBackupName != null) && (localEngineActivity.mLastBackupName.length() != 0) && (localEngineActivity.mLastBackupName.equals(paramString)))
          return;
        Object[] arrayOfObject = new Object[2];
        arrayOfObject[0] = paramString;
        arrayOfObject[1] = localEngineActivity.mLastBackupName;
        Log.d("engine", String.format("Backup: %s, prev:%s", arrayOfObject));
        if (localEngineActivity.agcEnabled)
        {
          SynchronizeBlobProgressRequest localSynchronizeBlobProgressRequest = new SynchronizeBlobProgressRequest(mWhispersyncBlobCallback);
          localSynchronizeBlobProgressRequest.setData(DbBackup.backupAll(localDatabaseHelper));
          localSynchronizeBlobProgressRequest.setDescription(paramString);
          AmazonGamesClient.getInstance().getWhisperSyncClient().synchronizeProgress(localSynchronizeBlobProgressRequest);
          localEngineActivity.mLastBackupName = paramString;
          localEngineActivity.savePreference("BackupTime", localEngineActivity.mLastBackupTime);
          localEngineActivity.savePreference("BackupName", localEngineActivity.mLastBackupName);
          return;
        }
      }
      catch (Exception localException)
      {
        Error.processException(localException);
        return;
      }
      new BackupManager(localEngineActivity).dataChanged();
    }
  }

  private void savePreference(String paramString, long paramLong)
  {
    SharedPreferences.Editor localEditor = getPreferences(0).edit();
    localEditor.putLong(paramString, paramLong);
    localEditor.commit();
  }

  private void savePreference(String paramString1, String paramString2)
  {
    SharedPreferences.Editor localEditor = getPreferences(0).edit();
    localEditor.putString(paramString1, paramString2);
    localEditor.commit();
  }

  // ERROR //
  public static void sendEmail(String paramString, int paramInt)
  {
    // Byte code:
    //   0: invokestatic 215	com/melesta/engine/EngineActivity:getInstance	()Lcom/melesta/engine/EngineActivity;
    //   3: astore_3
    //   4: aload_3
    //   5: invokevirtual 947	com/melesta/engine/EngineActivity:getApplicationContext	()Landroid/content/Context;
    //   8: invokevirtual 953	android/content/Context:getResources	()Landroid/content/res/Resources;
    //   11: astore 4
    //   13: aload_3
    //   14: invokevirtual 609	com/melesta/engine/EngineActivity:getPackageName	()Ljava/lang/String;
    //   17: astore 5
    //   19: aload 4
    //   21: aload_0
    //   22: ldc_w 955
    //   25: aload 5
    //   27: invokevirtual 961	android/content/res/Resources:getIdentifier	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
    //   30: istore 6
    //   32: iconst_3
    //   33: anewarray 448	java/lang/Object
    //   36: astore 7
    //   38: aload 7
    //   40: iconst_0
    //   41: aload_0
    //   42: aastore
    //   43: aload 7
    //   45: iconst_1
    //   46: iload_1
    //   47: invokestatic 967	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   50: aastore
    //   51: aload 7
    //   53: iconst_2
    //   54: iload 6
    //   56: invokestatic 967	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   59: aastore
    //   60: ldc_w 630
    //   63: ldc_w 969
    //   66: aload 7
    //   68: invokestatic 452	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   71: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   74: iload 6
    //   76: ifne +4 -> 80
    //   79: return
    //   80: ldc_w 637
    //   83: astore 8
    //   85: ldc_w 637
    //   88: astore 9
    //   90: ldc_w 637
    //   93: astore 10
    //   95: aload 4
    //   97: iload 6
    //   99: invokevirtual 973	android/content/res/Resources:getXml	(I)Landroid/content/res/XmlResourceParser;
    //   102: astore 12
    //   104: aload 12
    //   106: invokeinterface 977 1 0
    //   111: pop
    //   112: aload 12
    //   114: invokeinterface 977 1 0
    //   119: pop
    //   120: aload 12
    //   122: invokeinterface 977 1 0
    //   127: istore 51
    //   129: iload 51
    //   131: iconst_1
    //   132: if_icmpeq +150 -> 282
    //   135: iload 51
    //   137: iconst_2
    //   138: if_icmpne +32 -> 170
    //   141: aload 12
    //   143: invokeinterface 980 1 0
    //   148: astore 52
    //   150: aload 52
    //   152: ldc_w 982
    //   155: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   158: ifeq +24 -> 182
    //   161: aload 12
    //   163: invokeinterface 985 1 0
    //   168: astore 8
    //   170: aload 12
    //   172: invokeinterface 977 1 0
    //   177: istore 51
    //   179: goto -50 -> 129
    //   182: aload 52
    //   184: ldc_w 987
    //   187: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   190: ifeq +15 -> 205
    //   193: aload 12
    //   195: invokeinterface 985 1 0
    //   200: astore 9
    //   202: goto -32 -> 170
    //   205: aload 52
    //   207: ldc_w 989
    //   210: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   213: ifeq +15 -> 228
    //   216: aload 12
    //   218: invokeinterface 985 1 0
    //   223: astore 10
    //   225: goto -55 -> 170
    //   228: aload 52
    //   230: ldc_w 991
    //   233: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   236: ifeq -66 -> 170
    //   239: aload 12
    //   241: invokeinterface 985 1 0
    //   246: invokestatic 995	java/lang/Integer:parseInt	(Ljava/lang/String;)I
    //   249: invokestatic 967	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   252: astore 53
    //   254: aload 53
    //   256: ifnull -86 -> 170
    //   259: aload 53
    //   261: invokevirtual 998	java/lang/Integer:intValue	()I
    //   264: istore 54
    //   266: iload 54
    //   268: istore_1
    //   269: goto -99 -> 170
    //   272: astore 13
    //   274: ldc_w 999
    //   277: aload 13
    //   279: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   282: new 253	java/lang/StringBuilder
    //   285: dup
    //   286: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   289: astore 14
    //   291: aload 14
    //   293: invokestatic 1004	com/melesta/engine/EngineApp:getAppId	()Ljava/lang/String;
    //   296: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   299: bipush 32
    //   301: invokevirtual 1007	java/lang/StringBuilder:append	(C)Ljava/lang/StringBuilder;
    //   304: aload_3
    //   305: invokespecial 1009	com/melesta/engine/EngineActivity:getSoftwareVersion	()Ljava/lang/String;
    //   308: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   311: ldc_w 1011
    //   314: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   317: invokestatic 1014	com/melesta/engine/EngineApp:getDeviceId	()Ljava/lang/String;
    //   320: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   323: bipush 41
    //   325: invokevirtual 1007	java/lang/StringBuilder:append	(C)Ljava/lang/StringBuilder;
    //   328: pop
    //   329: aload 9
    //   331: ldc_w 1016
    //   334: invokevirtual 1020	java/lang/String:contains	(Ljava/lang/CharSequence;)Z
    //   337: ifeq +27 -> 364
    //   340: iconst_1
    //   341: anewarray 448	java/lang/Object
    //   344: astore 48
    //   346: aload 48
    //   348: iconst_0
    //   349: aload 14
    //   351: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   354: aastore
    //   355: aload 9
    //   357: aload 48
    //   359: invokestatic 452	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   362: astore 9
    //   364: aload 9
    //   366: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   369: ifne +11 -> 380
    //   372: aload 10
    //   374: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   377: ifeq +12 -> 389
    //   380: ldc_w 630
    //   383: ldc_w 1025
    //   386: invokestatic 1027	com/melesta/engine/Log:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   389: aload_3
    //   390: iload_1
    //   391: putfield 123	com/melesta/engine/EngineActivity:mailId	I
    //   394: aload_0
    //   395: ldc_w 1029
    //   398: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   401: istore 16
    //   403: aconst_null
    //   404: astore 17
    //   406: iload 16
    //   408: ifeq +261 -> 669
    //   411: new 253	java/lang/StringBuilder
    //   414: dup
    //   415: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   418: invokestatic 1035	android/os/Environment:getExternalStorageDirectory	()Ljava/io/File;
    //   421: invokevirtual 1040	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   424: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   427: ldc_w 1042
    //   430: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   433: aload 5
    //   435: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   438: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   441: astore 18
    //   443: new 1037	java/io/File
    //   446: dup
    //   447: aload 18
    //   449: invokespecial 1043	java/io/File:<init>	(Ljava/lang/String;)V
    //   452: astore 19
    //   454: aload 19
    //   456: invokevirtual 1046	java/io/File:exists	()Z
    //   459: istore 21
    //   461: aconst_null
    //   462: astore 17
    //   464: iload 21
    //   466: ifne +9 -> 475
    //   469: aload 19
    //   471: invokevirtual 1049	java/io/File:mkdirs	()Z
    //   474: pop
    //   475: aload 5
    //   477: ldc_w 1051
    //   480: aload 19
    //   482: invokestatic 1055	java/io/File:createTempFile	(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;
    //   485: astore 23
    //   487: aload 23
    //   489: invokevirtual 1040	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   492: astore 17
    //   494: new 1057	java/io/FileOutputStream
    //   497: dup
    //   498: aload 23
    //   500: invokespecial 1060	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   503: astore 24
    //   505: new 191	java/io/DataOutputStream
    //   508: dup
    //   509: aload 24
    //   511: invokespecial 1063	java/io/DataOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   514: astore 25
    //   516: aload 4
    //   518: invokevirtual 1067	android/content/res/Resources:getConfiguration	()Landroid/content/res/Configuration;
    //   521: astore 26
    //   523: aload 14
    //   525: iconst_0
    //   526: aload 14
    //   528: invokevirtual 1068	java/lang/StringBuilder:length	()I
    //   531: invokevirtual 1072	java/lang/StringBuilder:delete	(II)Ljava/lang/StringBuilder;
    //   534: pop
    //   535: aload 14
    //   537: ldc_w 1074
    //   540: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   543: pop
    //   544: aload 14
    //   546: aload 26
    //   548: invokevirtual 1077	android/content/res/Configuration:toString	()Ljava/lang/String;
    //   551: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   554: pop
    //   555: aload 4
    //   557: invokevirtual 1081	android/content/res/Resources:getDisplayMetrics	()Landroid/util/DisplayMetrics;
    //   560: astore 30
    //   562: aload 30
    //   564: getfield 1086	android/util/DisplayMetrics:densityDpi	I
    //   567: sipush 240
    //   570: if_icmpne +131 -> 701
    //   573: aload 14
    //   575: ldc_w 1088
    //   578: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   581: pop
    //   582: bipush 15
    //   584: aload 26
    //   586: getfield 1091	android/content/res/Configuration:screenLayout	I
    //   589: iand
    //   590: iconst_3
    //   591: if_icmpne +227 -> 818
    //   594: aload 14
    //   596: ldc_w 1093
    //   599: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   602: pop
    //   603: aload 25
    //   605: aload 14
    //   607: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   610: invokevirtual 1097	java/lang/String:getBytes	()[B
    //   613: invokestatic 1103	com/melesta/engine/Cipher:encryptWeak	([B)[B
    //   616: invokestatic 1105	com/melesta/engine/EngineActivity:backupBytes	(Ljava/io/DataOutputStream;[B)V
    //   619: aload_3
    //   620: invokestatic 793	com/melesta/engine/DatabaseHelper:getHelper	(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;
    //   623: astore 33
    //   625: aconst_null
    //   626: aload 33
    //   628: invokestatic 1111	com/melesta/engine/BackupAgent:backupFiles	(Landroid/app/backup/BackupDataOutput;Lcom/melesta/engine/DatabaseHelper;)[B
    //   631: astore 39
    //   633: aload 39
    //   635: astore 35
    //   637: aload 25
    //   639: aload 35
    //   641: invokestatic 1103	com/melesta/engine/Cipher:encryptWeak	([B)[B
    //   644: invokestatic 1105	com/melesta/engine/EngineActivity:backupBytes	(Ljava/io/DataOutputStream;[B)V
    //   647: aconst_null
    //   648: aload 33
    //   650: invokestatic 1114	com/melesta/engine/BackupAgent:backupTransactions	(Landroid/app/backup/BackupDataOutput;Lcom/melesta/engine/DatabaseHelper;)[B
    //   653: astore 38
    //   655: aload 38
    //   657: astore 37
    //   659: aload 25
    //   661: aload 37
    //   663: invokestatic 1103	com/melesta/engine/Cipher:encryptWeak	([B)[B
    //   666: invokestatic 1105	com/melesta/engine/EngineActivity:backupBytes	(Ljava/io/DataOutputStream;[B)V
    //   669: aload 8
    //   671: aload 9
    //   673: aload 10
    //   675: aload 17
    //   677: invokestatic 1117	com/melesta/engine/EngineActivity:sendEmail	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //   680: return
    //   681: astore_2
    //   682: ldc_w 999
    //   685: aload_2
    //   686: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   689: return
    //   690: astore 11
    //   692: ldc_w 999
    //   695: aload 11
    //   697: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   700: return
    //   701: aload 30
    //   703: getfield 1086	android/util/DisplayMetrics:densityDpi	I
    //   706: bipush 120
    //   708: if_icmpne +25 -> 733
    //   711: aload 14
    //   713: ldc_w 1119
    //   716: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   719: pop
    //   720: goto -138 -> 582
    //   723: astore 20
    //   725: aload 20
    //   727: invokestatic 592	com/melesta/engine/Error:processException	(Ljava/lang/Exception;)V
    //   730: goto -61 -> 669
    //   733: aload 30
    //   735: getfield 1086	android/util/DisplayMetrics:densityDpi	I
    //   738: sipush 160
    //   741: if_icmpne +15 -> 756
    //   744: aload 14
    //   746: ldc_w 1121
    //   749: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   752: pop
    //   753: goto -171 -> 582
    //   756: aload 30
    //   758: getfield 1086	android/util/DisplayMetrics:densityDpi	I
    //   761: sipush 320
    //   764: if_icmpne +15 -> 779
    //   767: aload 14
    //   769: ldc_w 1123
    //   772: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   775: pop
    //   776: goto -194 -> 582
    //   779: aload 14
    //   781: new 253	java/lang/StringBuilder
    //   784: dup
    //   785: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   788: ldc_w 1125
    //   791: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   794: aload 30
    //   796: getfield 1086	android/util/DisplayMetrics:densityDpi	I
    //   799: invokevirtual 628	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   802: ldc_w 1127
    //   805: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   808: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   811: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   814: pop
    //   815: goto -233 -> 582
    //   818: bipush 15
    //   820: aload 26
    //   822: getfield 1091	android/content/res/Configuration:screenLayout	I
    //   825: iand
    //   826: iconst_4
    //   827: if_icmpne +15 -> 842
    //   830: aload 14
    //   832: ldc_w 1129
    //   835: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   838: pop
    //   839: goto -236 -> 603
    //   842: bipush 15
    //   844: aload 26
    //   846: getfield 1091	android/content/res/Configuration:screenLayout	I
    //   849: iand
    //   850: iconst_2
    //   851: if_icmpne +15 -> 866
    //   854: aload 14
    //   856: ldc_w 1131
    //   859: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   862: pop
    //   863: goto -260 -> 603
    //   866: bipush 15
    //   868: aload 26
    //   870: getfield 1091	android/content/res/Configuration:screenLayout	I
    //   873: iand
    //   874: iconst_1
    //   875: if_icmpne +15 -> 890
    //   878: aload 14
    //   880: ldc_w 1133
    //   883: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   886: pop
    //   887: goto -284 -> 603
    //   890: aload 14
    //   892: ldc_w 1135
    //   895: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   898: pop
    //   899: goto -296 -> 603
    //   902: astore 34
    //   904: aconst_null
    //   905: astore 35
    //   907: goto -270 -> 637
    //   910: astore 36
    //   912: aconst_null
    //   913: astore 37
    //   915: goto -256 -> 659
    //
    // Exception table:
    //   from	to	target	type
    //   104	129	272	org/xmlpull/v1/XmlPullParserException
    //   141	170	272	org/xmlpull/v1/XmlPullParserException
    //   170	179	272	org/xmlpull/v1/XmlPullParserException
    //   182	202	272	org/xmlpull/v1/XmlPullParserException
    //   205	225	272	org/xmlpull/v1/XmlPullParserException
    //   228	254	272	org/xmlpull/v1/XmlPullParserException
    //   259	266	272	org/xmlpull/v1/XmlPullParserException
    //   0	74	681	java/lang/Exception
    //   282	364	681	java/lang/Exception
    //   364	380	681	java/lang/Exception
    //   380	389	681	java/lang/Exception
    //   389	403	681	java/lang/Exception
    //   411	443	681	java/lang/Exception
    //   669	680	681	java/lang/Exception
    //   692	700	681	java/lang/Exception
    //   725	730	681	java/lang/Exception
    //   95	104	690	java/lang/Exception
    //   104	129	690	java/lang/Exception
    //   141	170	690	java/lang/Exception
    //   170	179	690	java/lang/Exception
    //   182	202	690	java/lang/Exception
    //   205	225	690	java/lang/Exception
    //   228	254	690	java/lang/Exception
    //   259	266	690	java/lang/Exception
    //   274	282	690	java/lang/Exception
    //   443	461	723	java/lang/Exception
    //   469	475	723	java/lang/Exception
    //   475	582	723	java/lang/Exception
    //   582	603	723	java/lang/Exception
    //   603	625	723	java/lang/Exception
    //   637	647	723	java/lang/Exception
    //   659	669	723	java/lang/Exception
    //   701	720	723	java/lang/Exception
    //   733	753	723	java/lang/Exception
    //   756	776	723	java/lang/Exception
    //   779	815	723	java/lang/Exception
    //   818	839	723	java/lang/Exception
    //   842	863	723	java/lang/Exception
    //   866	887	723	java/lang/Exception
    //   890	899	723	java/lang/Exception
    //   625	633	902	java/lang/Exception
    //   647	655	910	java/lang/Exception
  }

  public static void sendEmail(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    try
    {
      EngineActivity localEngineActivity = getInstance();
      Intent localIntent = new Intent("android.intent.action.SEND");
      localIntent.setType("message/rfc822");
      localIntent.putExtra("android.intent.extra.EMAIL", new String[] { paramString1 });
      localIntent.putExtra("android.intent.extra.SUBJECT", paramString2);
      localIntent.putExtra("android.intent.extra.TEXT", Html.fromHtml(paramString3));
      if (paramString4 != null)
        localIntent.putExtra("android.intent.extra.STREAM", Uri.parse("file://" + paramString4));
      try
      {
        localEngineActivity.startActivityForResult(Intent.createChooser(localIntent, "Send mail..."), 101);
        return;
      }
      catch (ActivityNotFoundException localActivityNotFoundException)
      {
        Toast.makeText(localEngineActivity, "There are no email clients installed.", 0).show();
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException("sendEmail", localException);
    }
  }

  public static void showAmazonGameCircleAchievements()
  {
    try
    {
      AmazonGames localAmazonGames = getInstance().agsGameClient;
      if (localAmazonGames == null)
        return;
      localAmazonGames.getAchievementsClient().showAchievementsOverlay(new Object[0]);
      return;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  public static void showAmazonGameCircleLeaderboard()
  {
    try
    {
      AmazonGames localAmazonGames = getInstance().agsGameClient;
      if (localAmazonGames == null)
        return;
      localAmazonGames.getLeaderboardsClient().showLeaderboardOverlay(null, new Object[0]);
      return;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  public static void showAmazonGameCircleLeaderboard(String paramString)
  {
    LeaderboardsClient localLeaderboardsClient;
    try
    {
      AmazonGames localAmazonGames = getInstance().agsGameClient;
      if (localAmazonGames == null)
        return;
      localLeaderboardsClient = localAmazonGames.getLeaderboardsClient();
      if ((paramString == null) || (paramString.length() == 0))
      {
        localLeaderboardsClient.showLeaderboardsOverlay(new Object[0]);
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException(localException);
      return;
    }
    localLeaderboardsClient.showLeaderboardOverlay(paramString, new Object[0]);
  }

  public static void showBackupManager()
  {
    try
    {
      AmazonGames localAmazonGames = getInstance().agsGameClient;
      if (localAmazonGames == null)
        return;
      localAmazonGames.getWhisperSyncClient().requestRevert(new RevertBlobCallback()
      {
        public void onPlayerCancelled()
        {
        }

        public void onRevertFailure(ErrorCode paramAnonymousErrorCode)
        {
        }

        public boolean onRevertedGameData(final byte[] paramAnonymousArrayOfByte)
        {
          EngineActivity.getInstance().mGLSurfaceView.queueEvent(new Runnable()
          {
            public void run()
            {
              EngineActivity.restoreAll(paramAnonymousArrayOfByte);
            }
          });
          return true;
        }
      });
      return;
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  public static void showBanner()
  {
    try
    {
      EngineActivity localEngineActivity = getInstance();
      if (localEngineActivity == null)
        return;
      if (localEngineActivity.mBanner != null)
      {
        localEngineActivity.runOnUiThread(new Runnable()
        {
          public void run()
          {
            try
            {
              View localView = this.val$me.findViewById(R.id.burstly_bannerview);
              if (localView != null)
                localView.setVisibility(0);
              return;
            }
            catch (Exception localException)
            {
              Error.processException(localException);
            }
          }
        });
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException(localException);
    }
  }

  private void showToast(String paramString)
  {
    Log.d("engine", "Toast:" + paramString);
  }

  private void sponsorPayRequestCoins()
  {
    try
    {
      String str = getResources().getString(R.string.sponsorpay_currency_name_prefs_key);
      SPCredentials localSPCredentials = SponsorPay.getCurrentCredentials();
      SPCurrencyServerListener local23 = new SPCurrencyServerListener()
      {
        public void onSPCurrencyDeltaReceived(CurrencyServerDeltaOfCoinsResponse paramAnonymousCurrencyServerDeltaOfCoinsResponse)
        {
          Object[] arrayOfObject = new Object[3];
          arrayOfObject[0] = Double.valueOf(paramAnonymousCurrencyServerDeltaOfCoinsResponse.getDeltaOfCoins());
          arrayOfObject[1] = this.val$usedTransactionId;
          arrayOfObject[2] = paramAnonymousCurrencyServerDeltaOfCoinsResponse.getLatestTransactionId();
          Log.d("Response From Currency Server", String.format("Delta of Coins: %s\n\nUsed Latest Transaction ID: %s\n\nReturned Latest Transaction ID: %s\n\n", arrayOfObject));
          EngineActivity.this.sponsorPaySaveCoins(paramAnonymousCurrencyServerDeltaOfCoinsResponse.getDeltaOfCoins());
        }

        public void onSPCurrencyServerError(CurrencyServerAbstractResponse paramAnonymousCurrencyServerAbstractResponse)
        {
          Object[] arrayOfObject = new Object[3];
          arrayOfObject[0] = paramAnonymousCurrencyServerAbstractResponse.getErrorType();
          arrayOfObject[1] = paramAnonymousCurrencyServerAbstractResponse.getErrorCode();
          arrayOfObject[2] = paramAnonymousCurrencyServerAbstractResponse.getErrorMessage();
          Log.d("Response or Request Error", String.format("%s\n%s\n%s\n", arrayOfObject));
        }
      };
      SponsorPayPublisher.requestNewCoins(getApplicationContext(), local23, str);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("sponsorPayRequestNewCoins", localException);
    }
  }

  public static void sponsorPayRequestNewCoins()
  {
    try
    {
      getInstance().sponsorPayRequestCoins();
      return;
    }
    catch (Exception localException)
    {
      Error.processException("sponsorPayRequestNewCoins", localException);
    }
  }

  private void sponsorPaySaveCoins(double paramDouble)
  {
    try
    {
      final SharedPreferences localSharedPreferences = getPreferences(0);
      final int i = (int)localSharedPreferences.getLong("SponsorPayCoins", 0L) + (int)paramDouble;
      savePreference("SponsorPayCoins", i);
      runOnGLThread(new Runnable()
      {
        public void run()
        {
          boolean bool = SPNativeDelegate.OnEarnPoints(i);
          Log.d("engine", "[SponsorPayDelegate] Update points: " + i + " " + bool);
          if (bool)
            EngineActivity.this.savePreference("SponsorPayCoins", (int)localSharedPreferences.getLong("SponsorPayCoins", 0L) - i);
        }
      });
      return;
    }
    catch (Exception localException)
    {
      Error.processException("sponsorPaySaveCoins", localException);
    }
  }

  public static void sponsorPayShowOfferPage()
  {
    try
    {
      EngineActivity localEngineActivity = getInstance();
      String str = localEngineActivity.getResources().getString(R.string.sponsorpay_currency_name_prefs_key);
      localEngineActivity.startActivityForResult(SponsorPayPublisher.getIntentForOfferWallActivity(localEngineActivity.getApplicationContext(), Boolean.valueOf(false), str, null), 255);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("sponsorPayShowOfferPage", localException);
    }
  }

  private static void tapjoyProcessEarnedPoints(TapjoyConnect paramTapjoyConnect, int paramInt)
  {
    if (paramInt <= 0);
    while (true)
    {
      return;
      try
      {
        boolean bool = com.melesta.engine.tapjoy.NativeDelegate.OnEarnPoints(paramInt);
        Log.d("engine", "[TapjoyDelegate] Update points: " + paramInt + " " + bool);
        if (bool)
        {
          paramTapjoyConnect.spendTapPoints(paramInt, new TapjoySpendPointsNotifier()
          {
            public void getSpendPointsResponse(String paramAnonymousString, int paramAnonymousInt)
            {
              Object[] arrayOfObject = new Object[2];
              arrayOfObject[0] = paramAnonymousString;
              arrayOfObject[1] = Integer.valueOf(paramAnonymousInt);
              Log.d("engine", String.format("[TapjoyDelegate] getSpendPointsResponse(%s, %d)", arrayOfObject));
            }

            public void getSpendPointsResponseFailed(String paramAnonymousString)
            {
              Log.d("engine", "[TapjoyDelegate] getSpendPointsResponseFailed: " + paramAnonymousString);
            }
          });
          return;
        }
      }
      catch (Exception localException)
      {
        Error.processException(localException);
      }
    }
  }

  public static void tapjoyRefreshEarnedCurrency()
  {
    try
    {
      TapjoyConnect localTapjoyConnect = TapjoyConnect.getTapjoyConnectInstance();
      if (localTapjoyConnect == null);
      while (true)
      {
        return;
        if (!mIsTapjoyRefreshEarnedCurrencyRequestRunning)
        {
          mIsTapjoyRefreshEarnedCurrencyRequestRunning = true;
          localTapjoyConnect.getTapPoints(new TapjoyNotifier()
          {
            public void getUpdatePoints(String paramAnonymousString, int paramAnonymousInt)
            {
              try
              {
                EngineActivity.tapjoyProcessEarnedPoints(this.val$tapjoy, paramAnonymousInt);
                EngineActivity.access$302(false);
                return;
              }
              catch (Exception localException)
              {
                while (true)
                {
                  Object[] arrayOfObject = new Object[2];
                  arrayOfObject[0] = paramAnonymousString;
                  arrayOfObject[1] = Integer.valueOf(paramAnonymousInt);
                  Error.processException(String.format("getUpdatePoints(%s, %d)", arrayOfObject), localException);
                }
              }
            }

            public void getUpdatePointsFailed(String paramAnonymousString)
            {
              try
              {
                Log.d("engine", "[TapjoyDelegate] getUpdatePointsFailed: " + paramAnonymousString);
                EngineActivity.access$302(false);
                return;
              }
              catch (Exception localException)
              {
                while (true)
                  Error.processException(String.format("getUpdatePointsFailed(%s)", new Object[] { paramAnonymousString }), localException);
              }
            }
          });
        }
      }
    }
    finally
    {
    }
  }

  public static void tapjoyShowOfferPage()
  {
    try
    {
      TapjoyConnect localTapjoyConnect = TapjoyConnect.getTapjoyConnectInstance();
      if (localTapjoyConnect == null)
      {
        EngineActivity localEngineActivity = getInstance();
        String str = localEngineActivity.getResources().getString(R.string.tapjoy_show_url_instead_of_ads);
        if (!str.isEmpty())
          openUrl(str.replace("[packagename]", localEngineActivity.getPackageName()));
      }
      else
      {
        localTapjoyConnect.showOffers();
        tapjoyRefreshEarnedCurrency();
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException("tapjoyShowOfferPage", localException);
    }
  }

  public static void updateAmazonGameCircleLeaderboard(String paramString, int paramInt)
  {
    LeaderboardsClient localLeaderboardsClient;
    final String str;
    try
    {
      AmazonGames localAmazonGames = getInstance().agsGameClient;
      if (localAmazonGames == null)
        return;
      localLeaderboardsClient = localAmazonGames.getLeaderboardsClient();
      if (localLeaderboardsClient == null)
        return;
      str = AwardsHelper.getHelper().getLeaderboardId(paramString);
      if (str == null)
      {
        Log.d("amazonGC", "Can't find:" + paramString);
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException(localException);
      return;
    }
    long l = paramInt;
    localLeaderboardsClient.submitScore(str, l, new Object[] { paramString }).setCallback(new AGResponseCallback()
    {
      public void onComplete(SubmitScoreResponse paramAnonymousSubmitScoreResponse)
      {
        if (paramAnonymousSubmitScoreResponse.isError())
          Log.d("amazonGC", this.val$leaderboardId + ":" + str + ":" + paramAnonymousSubmitScoreResponse.toString());
      }
    });
  }

  public static void updateAmazonGameCircleProgress(String paramString, final float paramFloat)
  {
    AmazonGames localAmazonGames = getInstance().agsGameClient;
    if (localAmazonGames == null)
      return;
    AchievementsClient localAchievementsClient;
    final String str;
    try
    {
      localAchievementsClient = localAmazonGames.getAchievementsClient();
      str = AwardsHelper.getHelper().getAchievementId(paramString);
      if (str == null)
      {
        Log.d("amazonGC", "Can't find:" + paramString);
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException(localException);
      return;
    }
    final boolean bool = localAmazonGames.isReady();
    localAchievementsClient.updateProgress(str, paramFloat, new Object[] { paramString }).setCallback(new AGResponseCallback()
    {
      public void onComplete(UpdateProgressResponse paramAnonymousUpdateProgressResponse)
      {
        if (paramAnonymousUpdateProgressResponse.isError())
        {
          String str = this.val$id + ":" + str + ":" + paramFloat + ":" + bool + ":";
          android.util.Log.d("amazonGC", str + paramAnonymousUpdateProgressResponse.toString());
        }
      }
    });
  }

  public void addTickListener(ActivityTickListener paramActivityTickListener)
  {
    try
    {
      synchronized (this.listeners)
      {
        if (!this.listeners.contains(paramActivityTickListener))
          this.listeners.add(paramActivityTickListener);
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException("addListener", localException);
    }
  }

  public void earnedTapPoints(int paramInt)
  {
    if (TapjoyConnect.getTapjoyConnectInstance() == null)
      return;
    tapjoyRefreshEarnedCurrency();
  }

  public Handler getHandler()
  {
    return this.mHandler;
  }

  public void init()
  {
    setContentView(R.layout.game);
    this.mFramelayout = ((RelativeLayout)findViewById(R.id.game_root_layout));
    EngineEditText localEngineEditText = (EngineEditText)findViewById(R.id.engineEditText);
    try
    {
      Resources localResources = getResources();
      String str1 = localResources.getString(R.string.burstly_app_id);
      String str2 = localResources.getString(R.string.burstly_zone_id);
      if ((!str1.isEmpty()) && (!str2.isEmpty()))
      {
        Burstly.init(this, str1);
        this.mBanner = new BurstlyAnimatedBanner(this, R.id.burstly_bannerview, true);
        this.mBanner.addBurstlyListener(new MyBurstlyListener());
        this.mBanner.setZoneId(str2);
        this.mBanner.showAd();
        hideBanner();
      }
      this.mGLSurfaceView = ((EngineGLSurfaceView)findViewById(R.id.engine_game_view));
      this.mRenderer = new Renderer();
      this.mGLSurfaceView.setEngineRenderer(this.mRenderer);
      this.mGLSurfaceView.setCocos2dxEditText(localEngineEditText);
      ViewGroup.LayoutParams localLayoutParams = new ViewGroup.LayoutParams(-1, -1);
      this.mProgressFramelayout = new RelativeLayout(this);
      this.mProgressFramelayout.setLayoutParams(localLayoutParams);
      this.mProgressFramelayout.setBackgroundColor(Color.argb(127, 0, 0, 0));
      RelativeLayout.LayoutParams localLayoutParams1 = new RelativeLayout.LayoutParams(-2, -2);
      localLayoutParams1.addRule(13);
      ProgressBar localProgressBar = new ProgressBar(this);
      localProgressBar.setLayoutParams(localLayoutParams1);
      this.mProgressFramelayout.addView(localProgressBar);
      setContentView(this.mFramelayout);
      return;
    }
    catch (Exception localException)
    {
      while (true)
        Error.processException("initBurstly", localException);
    }
  }

  public void onActivityResult(int paramInt1, final int paramInt2, Intent paramIntent)
  {
    try
    {
      super.onActivityResult(paramInt1, paramInt2, paramIntent);
      this.mUiHelper.onActivityResult(paramInt1, paramInt2, paramIntent);
      if (paramInt1 == 101)
      {
        Log.d("engine", "mail closed = " + paramInt2);
        runOnGLThread(new Runnable()
        {
          public void run()
          {
            if (paramInt2 == -1);
            for (int i = 2; ; i = 0)
            {
              com.melesta.mail.NativeDelegate.OnMailSended(i, EngineActivity.this.mailId);
              return;
            }
          }
        });
        return;
      }
      fireActivityResult(paramInt1, paramInt2, paramIntent);
      return;
    }
    catch (Exception localException)
    {
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = Integer.valueOf(paramInt1);
      arrayOfObject[1] = Integer.valueOf(paramInt2);
      Error.processException(String.format("onActivityResult(%d,%d)", arrayOfObject), localException);
    }
  }

  public void onBackPressed()
  {
    if ((this.mChartboost != null) && (this.mChartboost.onBackPressed()))
      return;
    super.onBackPressed();
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    super.onConfigurationChanged(paramConfiguration);
  }

  // ERROR //
  protected void onCreate(Bundle paramBundle)
  {
    // Byte code:
    //   0: ldc_w 630
    //   3: new 253	java/lang/StringBuilder
    //   6: dup
    //   7: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   10: ldc_w 1531
    //   13: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   16: aload_0
    //   17: invokevirtual 1535	com/melesta/engine/EngineActivity:getIntent	()Landroid/content/Intent;
    //   20: invokevirtual 1538	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   23: aload_0
    //   24: invokevirtual 1535	com/melesta/engine/EngineActivity:getIntent	()Landroid/content/Intent;
    //   27: invokevirtual 264	android/content/Intent:getExtras	()Landroid/os/Bundle;
    //   30: invokevirtual 1538	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   33: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   36: invokestatic 1541	com/melesta/engine/Log:v	(Ljava/lang/String;Ljava/lang/String;)V
    //   39: aload_0
    //   40: aload_1
    //   41: invokespecial 1543	android/app/Activity:onCreate	(Landroid/os/Bundle;)V
    //   44: aload_0
    //   45: putstatic 409	com/melesta/engine/EngineActivity:instance	Lcom/melesta/engine/EngineActivity;
    //   48: aload_0
    //   49: iconst_0
    //   50: invokevirtual 920	com/melesta/engine/EngineActivity:getPreferences	(I)Landroid/content/SharedPreferences;
    //   53: astore_3
    //   54: aload_0
    //   55: aload_3
    //   56: ldc 21
    //   58: ldc2_w 1544
    //   61: invokeinterface 1272 4 0
    //   66: putfield 859	com/melesta/engine/EngineActivity:mLastBackupTime	J
    //   69: aload_0
    //   70: aload_3
    //   71: ldc 18
    //   73: ldc_w 637
    //   76: invokeinterface 1548 3 0
    //   81: putfield 871	com/melesta/engine/EngineActivity:mLastBackupName	Ljava/lang/String;
    //   84: aload_0
    //   85: invokevirtual 606	com/melesta/engine/EngineActivity:getPackageManager	()Landroid/content/pm/PackageManager;
    //   88: aload_0
    //   89: invokevirtual 609	com/melesta/engine/EngineActivity:getPackageName	()Ljava/lang/String;
    //   92: bipush 64
    //   94: invokevirtual 615	android/content/pm/PackageManager:getPackageInfo	(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
    //   97: getfield 1552	android/content/pm/PackageInfo:signatures	[Landroid/content/pm/Signature;
    //   100: astore 4
    //   102: aload 4
    //   104: arraylength
    //   105: istore 5
    //   107: iconst_0
    //   108: istore 6
    //   110: iload 6
    //   112: iload 5
    //   114: if_icmpge +99 -> 213
    //   117: aload 4
    //   119: iload 6
    //   121: aaload
    //   122: astore 7
    //   124: ldc_w 1554
    //   127: new 253	java/lang/StringBuilder
    //   130: dup
    //   131: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   134: ldc_w 1556
    //   137: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   140: aload 7
    //   142: invokevirtual 1561	android/content/pm/Signature:toCharsString	()Ljava/lang/String;
    //   145: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   148: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   151: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   154: ldc_w 1563
    //   157: invokestatic 1568	java/security/MessageDigest:getInstance	(Ljava/lang/String;)Ljava/security/MessageDigest;
    //   160: astore 8
    //   162: aload 8
    //   164: aload 7
    //   166: invokevirtual 1571	android/content/pm/Signature:toByteArray	()[B
    //   169: invokevirtual 1574	java/security/MessageDigest:update	([B)V
    //   172: ldc_w 630
    //   175: new 253	java/lang/StringBuilder
    //   178: dup
    //   179: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   182: ldc_w 1556
    //   185: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   188: aload 8
    //   190: invokevirtual 1577	java/security/MessageDigest:digest	()[B
    //   193: iconst_0
    //   194: invokestatic 1583	android/util/Base64:encodeToString	([BI)Ljava/lang/String;
    //   197: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   200: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   203: invokestatic 1588	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   206: pop
    //   207: iinc 6 1
    //   210: goto -100 -> 110
    //   213: aload_0
    //   214: invokevirtual 320	com/melesta/engine/EngineActivity:getWindow	()Landroid/view/Window;
    //   217: sipush 128
    //   220: invokevirtual 1593	android/view/Window:addFlags	(I)V
    //   223: aload_0
    //   224: invokevirtual 1230	com/melesta/engine/EngineActivity:getResources	()Landroid/content/res/Resources;
    //   227: astore 10
    //   229: aload 10
    //   231: invokevirtual 1067	android/content/res/Resources:getConfiguration	()Landroid/content/res/Configuration;
    //   234: astore 11
    //   236: aload_0
    //   237: aload 11
    //   239: getfield 1597	android/content/res/Configuration:locale	Ljava/util/Locale;
    //   242: invokevirtual 1602	java/util/Locale:getLanguage	()Ljava/lang/String;
    //   245: putfield 494	com/melesta/engine/EngineActivity:mLanguage	Ljava/lang/String;
    //   248: ldc_w 630
    //   251: new 253	java/lang/StringBuilder
    //   254: dup
    //   255: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   258: ldc_w 1604
    //   261: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   264: aload_0
    //   265: getfield 494	com/melesta/engine/EngineActivity:mLanguage	Ljava/lang/String;
    //   268: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   271: ldc_w 1606
    //   274: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   277: aload 11
    //   279: getfield 1597	android/content/res/Configuration:locale	Ljava/util/Locale;
    //   282: invokevirtual 1609	java/util/Locale:getISO3Language	()Ljava/lang/String;
    //   285: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   288: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   291: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   294: ldc_w 630
    //   297: new 253	java/lang/StringBuilder
    //   300: dup
    //   301: invokespecial 254	java/lang/StringBuilder:<init>	()V
    //   304: ldc_w 1611
    //   307: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   310: aload 11
    //   312: getfield 1597	android/content/res/Configuration:locale	Ljava/util/Locale;
    //   315: invokevirtual 1614	java/util/Locale:getISO3Country	()Ljava/lang/String;
    //   318: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   321: ldc_w 1606
    //   324: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   327: aload 11
    //   329: getfield 1597	android/content/res/Configuration:locale	Ljava/util/Locale;
    //   332: invokevirtual 1617	java/util/Locale:getCountry	()Ljava/lang/String;
    //   335: invokevirtual 260	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   338: invokevirtual 273	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   341: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   344: aload_0
    //   345: getfield 494	com/melesta/engine/EngineActivity:mLanguage	Ljava/lang/String;
    //   348: ldc_w 1619
    //   351: invokevirtual 659	java/lang/String:equalsIgnoreCase	(Ljava/lang/String;)Z
    //   354: ifeq +27 -> 381
    //   357: aload 11
    //   359: getfield 1597	android/content/res/Configuration:locale	Ljava/util/Locale;
    //   362: invokevirtual 1617	java/util/Locale:getCountry	()Ljava/lang/String;
    //   365: ldc_w 1621
    //   368: invokevirtual 659	java/lang/String:equalsIgnoreCase	(Ljava/lang/String;)Z
    //   371: ifeq +10 -> 381
    //   374: aload_0
    //   375: ldc_w 1623
    //   378: putfield 494	com/melesta/engine/EngineActivity:mLanguage	Ljava/lang/String;
    //   381: aload_0
    //   382: invokestatic 793	com/melesta/engine/DatabaseHelper:getHelper	(Landroid/content/Context;)Lcom/melesta/engine/DatabaseHelper;
    //   385: astore 12
    //   387: aload 12
    //   389: iconst_0
    //   390: invokevirtual 1627	com/melesta/engine/DatabaseHelper:getFilesList	(Z)Ljava/util/List;
    //   393: invokeinterface 1630 1 0
    //   398: ifne +798 -> 1196
    //   401: iconst_1
    //   402: istore 13
    //   404: getstatic 1633	com/melesta/engine/Log:isDebug	Z
    //   407: ifeq +669 -> 1076
    //   410: getstatic 1636	com/melesta/engine/R$string:promo_code_debug_url	I
    //   413: istore 14
    //   415: aload_0
    //   416: iload 14
    //   418: invokevirtual 1637	com/melesta/engine/EngineActivity:getString	(I)Ljava/lang/String;
    //   421: putstatic 201	com/melesta/engine/EngineActivity:mPromoCodeUrl	Ljava/lang/String;
    //   424: getstatic 1643	com/facebook/LoggingBehavior:INCLUDE_ACCESS_TOKENS	Lcom/facebook/LoggingBehavior;
    //   427: invokestatic 1649	com/facebook/Settings:addLoggingBehavior	(Lcom/facebook/LoggingBehavior;)V
    //   430: new 1504	com/facebook/UiLifecycleHelper
    //   433: dup
    //   434: aload_0
    //   435: aload_0
    //   436: getfield 114	com/melesta/engine/EngineActivity:facebookStatusCallback	Lcom/facebook/Session$StatusCallback;
    //   439: invokespecial 1652	com/facebook/UiLifecycleHelper:<init>	(Landroid/app/Activity;Lcom/facebook/Session$StatusCallback;)V
    //   442: astore 15
    //   444: aload_0
    //   445: aload 15
    //   447: putfield 1502	com/melesta/engine/EngineActivity:mUiHelper	Lcom/facebook/UiLifecycleHelper;
    //   450: invokestatic 1658	com/facebook/Session:getActiveSession	()Lcom/facebook/Session;
    //   453: astore 45
    //   455: aload 45
    //   457: ifnull +19 -> 476
    //   460: aload 45
    //   462: invokevirtual 1662	com/facebook/Session:getPermissions	()Ljava/util/List;
    //   465: getstatic 1665	com/melesta/engine/FacebookOperations:READ_PERMISSIONS	Ljava/util/List;
    //   468: invokeinterface 1669 2 0
    //   473: ifne +24 -> 497
    //   476: aload_1
    //   477: ifnull +15 -> 492
    //   480: aload_0
    //   481: aconst_null
    //   482: aload_0
    //   483: getfield 114	com/melesta/engine/EngineActivity:facebookStatusCallback	Lcom/facebook/Session$StatusCallback;
    //   486: aload_1
    //   487: invokestatic 1673	com/facebook/Session:restoreSession	(Landroid/content/Context;Lcom/facebook/TokenCachingStrategy;Lcom/facebook/Session$StatusCallback;Landroid/os/Bundle;)Lcom/facebook/Session;
    //   490: astore 45
    //   492: aload 45
    //   494: invokestatic 1677	com/facebook/Session:setActiveSession	(Lcom/facebook/Session;)V
    //   497: aload_0
    //   498: getfield 1502	com/melesta/engine/EngineActivity:mUiHelper	Lcom/facebook/UiLifecycleHelper;
    //   501: aload_1
    //   502: invokevirtual 1678	com/facebook/UiLifecycleHelper:onCreate	(Landroid/os/Bundle;)V
    //   505: aload_0
    //   506: aload 10
    //   508: getstatic 1681	com/melesta/engine/R$string:flurry_api_key	I
    //   511: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   514: putfield 1683	com/melesta/engine/EngineActivity:mFlurryApiKey	Ljava/lang/String;
    //   517: aload 10
    //   519: getstatic 1686	com/melesta/engine/R$string:tapjoy_app_id	I
    //   522: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   525: astore 17
    //   527: aload 10
    //   529: getstatic 1689	com/melesta/engine/R$string:tapjoy_secret_key	I
    //   532: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   535: astore 18
    //   537: aload 10
    //   539: getstatic 1692	com/melesta/engine/R$string:sponsorpay_app_id_prefs_key	I
    //   542: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   545: astore 19
    //   547: aload 19
    //   549: ifnull +45 -> 594
    //   552: aload 19
    //   554: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   557: ifne +37 -> 594
    //   560: aload 10
    //   562: getstatic 1695	com/melesta/engine/R$string:sponsorpay_user_id_prefs_key	I
    //   565: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   568: astore 41
    //   570: aload 10
    //   572: getstatic 1698	com/melesta/engine/R$string:sponsorpay_security_token_prefs_key	I
    //   575: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   578: astore 42
    //   580: aload 19
    //   582: aload 41
    //   584: aload 42
    //   586: aload_0
    //   587: invokevirtual 947	com/melesta/engine/EngineActivity:getApplicationContext	()Landroid/content/Context;
    //   590: invokestatic 1701	com/sponsorpay/sdk/android/SponsorPay:start	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/content/Context;)Ljava/lang/String;
    //   593: pop
    //   594: aload_0
    //   595: aload 10
    //   597: getstatic 1704	com/melesta/engine/R$string:amazon_game_circle_enabled	I
    //   600: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   603: ldc_w 1706
    //   606: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   609: putfield 486	com/melesta/engine/EngineActivity:agcEnabled	Z
    //   612: aload_0
    //   613: getfield 486	com/melesta/engine/EngineActivity:agcEnabled	Z
    //   616: ifeq +41 -> 657
    //   619: aload_0
    //   620: getstatic 1712	com/amazon/ags/api/AmazonGamesFeature:Achievements	Lcom/amazon/ags/api/AmazonGamesFeature;
    //   623: invokestatic 1718	java/util/EnumSet:of	(Ljava/lang/Enum;)Ljava/util/EnumSet;
    //   626: putfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   629: aload 10
    //   631: getstatic 1721	com/melesta/engine/R$string:amazon_game_circle_leaderbords_enabled	I
    //   634: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   637: ldc_w 1706
    //   640: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   643: ifeq +14 -> 657
    //   646: aload_0
    //   647: getfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   650: getstatic 1724	com/amazon/ags/api/AmazonGamesFeature:Leaderboards	Lcom/amazon/ags/api/AmazonGamesFeature;
    //   653: invokevirtual 1725	java/util/EnumSet:add	(Ljava/lang/Object;)Z
    //   656: pop
    //   657: aload 10
    //   659: getstatic 1728	com/melesta/engine/R$string:amazon_whispersync_enabled	I
    //   662: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   665: ldc_w 1706
    //   668: invokevirtual 874	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   671: ifeq +25 -> 696
    //   674: aload_0
    //   675: iconst_1
    //   676: putfield 486	com/melesta/engine/EngineActivity:agcEnabled	Z
    //   679: aload_0
    //   680: getfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   683: ifnonnull +436 -> 1119
    //   686: aload_0
    //   687: getstatic 1731	com/amazon/ags/api/AmazonGamesFeature:Whispersync	Lcom/amazon/ags/api/AmazonGamesFeature;
    //   690: invokestatic 1718	java/util/EnumSet:of	(Ljava/lang/Enum;)Ljava/util/EnumSet;
    //   693: putfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   696: aload_0
    //   697: getfield 486	com/melesta/engine/EngineActivity:agcEnabled	Z
    //   700: ifeq +40 -> 740
    //   703: aload_0
    //   704: aload_0
    //   705: invokevirtual 1735	com/melesta/engine/EngineActivity:getApplication	()Landroid/app/Application;
    //   708: aload_0
    //   709: getfield 121	com/melesta/engine/EngineActivity:agsGameCallback	Lcom/amazon/ags/api/AmazonGamesCallback;
    //   712: aload_0
    //   713: getfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   716: invokestatic 1739	com/amazon/ags/api/AmazonGamesClient:initialize	(Landroid/app/Application;Lcom/amazon/ags/api/AmazonGamesCallback;Ljava/util/EnumSet;)Lcom/amazon/ags/api/AmazonGames;
    //   719: putfield 807	com/melesta/engine/EngineActivity:agsGameClient	Lcom/amazon/ags/api/AmazonGames;
    //   722: aload 10
    //   724: getstatic 1744	com/melesta/engine/R$raw:awards	I
    //   727: invokevirtual 1748	android/content/res/Resources:openRawResource	(I)Ljava/io/InputStream;
    //   730: astore 38
    //   732: invokestatic 818	com/melesta/engine/AwardsHelper:getHelper	()Lcom/melesta/engine/AwardsHelper;
    //   735: aload 38
    //   737: invokevirtual 1752	com/melesta/engine/AwardsHelper:loadConfig	(Ljava/io/InputStream;)V
    //   740: aload 10
    //   742: getstatic 1755	com/melesta/engine/R$string:chartboost_app_id	I
    //   745: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   748: astore 36
    //   750: aload 10
    //   752: getstatic 1758	com/melesta/engine/R$string:chartboost_signature	I
    //   755: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   758: astore 37
    //   760: aload_0
    //   761: invokestatic 1762	com/chartboost/sdk/Chartboost:sharedChartboost	()Lcom/chartboost/sdk/Chartboost;
    //   764: putfield 217	com/melesta/engine/EngineActivity:mChartboost	Lcom/chartboost/sdk/Chartboost;
    //   767: aload_0
    //   768: getfield 217	com/melesta/engine/EngineActivity:mChartboost	Lcom/chartboost/sdk/Chartboost;
    //   771: aload_0
    //   772: aload 36
    //   774: aload 37
    //   776: aconst_null
    //   777: invokevirtual 1765	com/chartboost/sdk/Chartboost:onCreate	(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;Lcom/chartboost/sdk/ChartboostDelegate;)V
    //   780: aload_0
    //   781: getfield 217	com/melesta/engine/EngineActivity:mChartboost	Lcom/chartboost/sdk/Chartboost;
    //   784: invokevirtual 1768	com/chartboost/sdk/Chartboost:startSession	()V
    //   787: aload_0
    //   788: getfield 217	com/melesta/engine/EngineActivity:mChartboost	Lcom/chartboost/sdk/Chartboost;
    //   791: invokevirtual 228	com/chartboost/sdk/Chartboost:cacheInterstitial	()V
    //   794: aload 17
    //   796: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   799: ifne +39 -> 838
    //   802: aload 18
    //   804: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   807: ifne +31 -> 838
    //   810: ldc_w 630
    //   813: ldc_w 1770
    //   816: invokestatic 502	com/melesta/engine/Log:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   819: iconst_1
    //   820: invokestatic 1775	com/tapjoy/TapjoyLog:enableLogging	(Z)V
    //   823: aload_0
    //   824: aload 17
    //   826: aload 18
    //   828: invokestatic 1779	com/tapjoy/TapjoyConnect:requestTapjoyConnect	(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    //   831: invokestatic 1319	com/tapjoy/TapjoyConnect:getTapjoyConnectInstance	()Lcom/tapjoy/TapjoyConnect;
    //   834: aload_0
    //   835: invokevirtual 1783	com/tapjoy/TapjoyConnect:setEarnedPointsNotifier	(Lcom/tapjoy/TapjoyEarnedPointsNotifier;)V
    //   838: aload 10
    //   840: getstatic 1786	com/melesta/engine/R$string:pushwoosh_app_id	I
    //   843: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   846: astore 33
    //   848: aload 10
    //   850: getstatic 1789	com/melesta/engine/R$string:pushwoosh_sender_id	I
    //   853: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   856: astore 34
    //   858: aload 33
    //   860: ifnull +49 -> 909
    //   863: aload 33
    //   865: invokevirtual 1023	java/lang/String:isEmpty	()Z
    //   868: ifne +41 -> 909
    //   871: aload_0
    //   872: invokevirtual 1535	com/melesta/engine/EngineActivity:getIntent	()Landroid/content/Intent;
    //   875: invokevirtual 1792	android/content/Intent:getFlags	()I
    //   878: ifeq +31 -> 909
    //   881: new 1794	com/arellomobile/android/push/PushManager
    //   884: dup
    //   885: aload_0
    //   886: aload 33
    //   888: aload 34
    //   890: invokespecial 1796	com/arellomobile/android/push/PushManager:<init>	(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    //   893: astore 35
    //   895: aload 35
    //   897: aload_0
    //   898: invokevirtual 1799	com/arellomobile/android/push/PushManager:onStartup	(Landroid/content/Context;)V
    //   901: aload_0
    //   902: aload_0
    //   903: invokevirtual 1535	com/melesta/engine/EngineActivity:getIntent	()Landroid/content/Intent;
    //   906: invokespecial 1801	com/melesta/engine/EngineActivity:checkMessage	(Landroid/content/Intent;)V
    //   909: new 1803	com/melesta/engine/EngineActivity$2
    //   912: dup
    //   913: aload_0
    //   914: invokespecial 1804	com/melesta/engine/EngineActivity$2:<init>	(Lcom/melesta/engine/EngineActivity;)V
    //   917: astore 24
    //   919: aload 12
    //   921: aload 24
    //   923: invokevirtual 1808	com/melesta/engine/DatabaseHelper:getTransactions	(Lcom/melesta/engine/DatabaseHelper$IObjectFilter;)Ljava/util/List;
    //   926: astore 25
    //   928: aload 25
    //   930: invokeinterface 1630 1 0
    //   935: ifle +37 -> 972
    //   938: new 1810	java/util/Timer
    //   941: dup
    //   942: ldc_w 1812
    //   945: invokespecial 1813	java/util/Timer:<init>	(Ljava/lang/String;)V
    //   948: astore 26
    //   950: new 1815	com/melesta/engine/EngineActivity$3
    //   953: dup
    //   954: aload_0
    //   955: aload 25
    //   957: invokespecial 1818	com/melesta/engine/EngineActivity$3:<init>	(Lcom/melesta/engine/EngineActivity;Ljava/util/List;)V
    //   960: astore 27
    //   962: aload 26
    //   964: aload 27
    //   966: ldc2_w 1819
    //   969: invokevirtual 1824	java/util/Timer:schedule	(Ljava/util/TimerTask;J)V
    //   972: aload 10
    //   974: getstatic 1827	com/melesta/engine/R$string:mobileapptracking_advertiser_id	I
    //   977: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   980: astore 28
    //   982: aload 10
    //   984: getstatic 1830	com/melesta/engine/R$string:mobileapptracking_app_key	I
    //   987: invokevirtual 1238	android/content/res/Resources:getString	(I)Ljava/lang/String;
    //   990: astore 29
    //   992: aload 28
    //   994: ifnull +61 -> 1055
    //   997: aload 28
    //   999: invokevirtual 207	java/lang/String:length	()I
    //   1002: ifle +53 -> 1055
    //   1005: new 1832	com/mobileapptracker/MobileAppTracker
    //   1008: dup
    //   1009: aload_0
    //   1010: invokevirtual 1835	com/melesta/engine/EngineActivity:getBaseContext	()Landroid/content/Context;
    //   1013: aload 28
    //   1015: aload 29
    //   1017: invokespecial 1836	com/mobileapptracker/MobileAppTracker:<init>	(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    //   1020: astore 30
    //   1022: aload_0
    //   1023: aload 30
    //   1025: putfield 97	com/melesta/engine/EngineActivity:mobileAppTracker	Lcom/mobileapptracker/MobileAppTracker;
    //   1028: getstatic 1633	com/melesta/engine/Log:isDebug	Z
    //   1031: ifeq +11 -> 1042
    //   1034: aload_0
    //   1035: getfield 97	com/melesta/engine/EngineActivity:mobileAppTracker	Lcom/mobileapptracker/MobileAppTracker;
    //   1038: iconst_1
    //   1039: invokevirtual 1839	com/mobileapptracker/MobileAppTracker:setDebugMode	(Z)V
    //   1042: iload 13
    //   1044: ifeq +141 -> 1185
    //   1047: aload_0
    //   1048: getfield 97	com/melesta/engine/EngineActivity:mobileAppTracker	Lcom/mobileapptracker/MobileAppTracker;
    //   1051: invokevirtual 1842	com/mobileapptracker/MobileAppTracker:trackInstall	()I
    //   1054: pop
    //   1055: aload_0
    //   1056: invokevirtual 1844	com/melesta/engine/EngineActivity:init	()V
    //   1059: aload_0
    //   1060: getstatic 1850	com/melesta/expansions/ActivityState:CREATE	Lcom/melesta/expansions/ActivityState;
    //   1063: invokespecial 1852	com/melesta/engine/EngineActivity:fireActivityStateChange	(Lcom/melesta/expansions/ActivityState;)V
    //   1066: ldc_w 630
    //   1069: ldc_w 1854
    //   1072: invokestatic 1541	com/melesta/engine/Log:v	(Ljava/lang/String;Ljava/lang/String;)V
    //   1075: return
    //   1076: getstatic 1857	com/melesta/engine/R$string:promo_code_url	I
    //   1079: istore 14
    //   1081: goto -666 -> 415
    //   1084: astore 16
    //   1086: ldc_w 1859
    //   1089: aload 16
    //   1091: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1094: goto -589 -> 505
    //   1097: astore_2
    //   1098: ldc_w 1860
    //   1101: aload_2
    //   1102: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1105: return
    //   1106: astore 43
    //   1108: ldc_w 1862
    //   1111: aload 43
    //   1113: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1116: goto -522 -> 594
    //   1119: aload_0
    //   1120: getfield 125	com/melesta/engine/EngineActivity:agsGameFeatures	Ljava/util/EnumSet;
    //   1123: getstatic 1731	com/amazon/ags/api/AmazonGamesFeature:Whispersync	Lcom/amazon/ags/api/AmazonGamesFeature;
    //   1126: invokevirtual 1725	java/util/EnumSet:add	(Ljava/lang/Object;)Z
    //   1129: pop
    //   1130: goto -434 -> 696
    //   1133: astore 20
    //   1135: ldc_w 1864
    //   1138: aload 20
    //   1140: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1143: goto -403 -> 740
    //   1146: astore 21
    //   1148: ldc_w 1866
    //   1151: aload 21
    //   1153: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1156: goto -362 -> 794
    //   1159: astore 22
    //   1161: ldc_w 1868
    //   1164: aload 22
    //   1166: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1169: goto -331 -> 838
    //   1172: astore 23
    //   1174: ldc_w 1870
    //   1177: aload 23
    //   1179: invokestatic 242	com/melesta/engine/Error:processException	(Ljava/lang/String;Ljava/lang/Exception;)V
    //   1182: goto -273 -> 909
    //   1185: aload_0
    //   1186: getfield 97	com/melesta/engine/EngineActivity:mobileAppTracker	Lcom/mobileapptracker/MobileAppTracker;
    //   1189: invokevirtual 1873	com/mobileapptracker/MobileAppTracker:trackUpdate	()I
    //   1192: pop
    //   1193: goto -138 -> 1055
    //   1196: iconst_0
    //   1197: istore 13
    //   1199: goto -795 -> 404
    //
    // Exception table:
    //   from	to	target	type
    //   430	455	1084	java/lang/Exception
    //   460	476	1084	java/lang/Exception
    //   480	492	1084	java/lang/Exception
    //   492	497	1084	java/lang/Exception
    //   497	505	1084	java/lang/Exception
    //   48	107	1097	java/lang/Exception
    //   117	207	1097	java/lang/Exception
    //   213	381	1097	java/lang/Exception
    //   381	401	1097	java/lang/Exception
    //   404	415	1097	java/lang/Exception
    //   415	430	1097	java/lang/Exception
    //   505	547	1097	java/lang/Exception
    //   552	580	1097	java/lang/Exception
    //   580	594	1097	java/lang/Exception
    //   909	972	1097	java/lang/Exception
    //   972	992	1097	java/lang/Exception
    //   997	1042	1097	java/lang/Exception
    //   1047	1055	1097	java/lang/Exception
    //   1055	1075	1097	java/lang/Exception
    //   1076	1081	1097	java/lang/Exception
    //   1086	1094	1097	java/lang/Exception
    //   1108	1116	1097	java/lang/Exception
    //   1135	1143	1097	java/lang/Exception
    //   1148	1156	1097	java/lang/Exception
    //   1161	1169	1097	java/lang/Exception
    //   1174	1182	1097	java/lang/Exception
    //   1185	1193	1097	java/lang/Exception
    //   580	594	1106	java/lang/RuntimeException
    //   594	657	1133	java/lang/Exception
    //   657	696	1133	java/lang/Exception
    //   696	740	1133	java/lang/Exception
    //   1119	1130	1133	java/lang/Exception
    //   740	794	1146	java/lang/Exception
    //   794	838	1159	java/lang/Exception
    //   838	858	1172	java/lang/Exception
    //   863	909	1172	java/lang/Exception
  }

  public EngineGLSurfaceView onCreateView()
  {
    return new EngineGLSurfaceView(this);
  }

  protected void onDestroy()
  {
    try
    {
      Log.v("engine", "onDestroy()");
      super.onDestroy();
      this.mChartboost.onDestroy(this);
      runBackup();
      this.mUiHelper.onDestroy();
      if (this.mBanner != null)
        Burstly.onDestroyActivity(this);
      fireActivityStateChange(ActivityState.DESTROY);
      Log.v("engine", "onDestroy() - done");
      return;
    }
    catch (Exception localException)
    {
      Error.processException("onDestroy", localException);
    }
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  protected void onNewIntent(Intent paramIntent)
  {
    super.onNewIntent(paramIntent);
    setIntent(paramIntent);
    checkMessage(paramIntent);
    setIntent(new Intent());
  }

  protected void onPause()
  {
    try
    {
      Log.d("engine", "EngineActivity  onPause");
      super.onPause();
      this.mUiHelper.onPause();
      fireActivityStateChange(ActivityState.PAUSE);
      this.mGLSurfaceView.onPause();
      if (this.mBanner != null)
        Burstly.onPauseActivity(this);
      Log.d("engine", "EngineActivity  onPause - done");
      return;
    }
    catch (Exception localException)
    {
      Error.processException("onPause", localException);
    }
  }

  protected void onResume()
  {
    try
    {
      Log.d("engine", "EngineActivity  onResume");
      super.onResume();
      this.mUiHelper.onResume();
      fireActivityStateChange(ActivityState.RESUME);
      this.mGLSurfaceView.onResume();
      if (this.mBanner != null)
        Burstly.onResumeActivity(this);
      String str = getResources().getString(R.string.sponsorpay_app_id_prefs_key);
      if ((str != null) && (!str.isEmpty()))
        sponsorPayRequestCoins();
      Log.d("engine", "EngineActivity  onResume - done");
      return;
    }
    catch (Exception localException)
    {
      Error.processException("onResume", localException);
    }
  }

  protected void onSaveInstanceState(Bundle paramBundle)
  {
    try
    {
      super.onSaveInstanceState(paramBundle);
      this.mUiHelper.onSaveInstanceState(paramBundle);
      return;
    }
    catch (Exception localException)
    {
      Error.processException("onSaveInstanceState", localException);
    }
  }

  protected void onStart()
  {
    try
    {
      Log.d("engine", "EngineActivity  onStart");
      super.onStart();
      this.mChartboost.onStart(this);
      if ((this.mFlurryApiKey != null) && (this.mFlurryApiKey.length() > 0))
        FlurryAgent.onStartSession(this, this.mFlurryApiKey);
      try
      {
        File localFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp/" + getPackageName());
        File[] arrayOfFile = localFile.listFiles();
        if (arrayOfFile != null)
        {
          int i = arrayOfFile.length;
          for (int j = 0; j < i; j++)
            arrayOfFile[j].delete();
        }
        localFile.delete();
        fireActivityStateChange(ActivityState.START);
        Log.d("engine", "EngineActivity  onStart - done");
        return;
      }
      catch (Exception localException2)
      {
        while (true)
          Error.processException(localException2);
      }
    }
    catch (Exception localException1)
    {
      Error.processException("onStart", localException1);
    }
  }

  protected void onStop()
  {
    try
    {
      Log.d("engine", "EngineActivity  onStop");
      super.onStop();
      this.mChartboost.onStop(this);
      fireActivityStateChange(ActivityState.STOP);
      if ((this.mFlurryApiKey != null) && (this.mFlurryApiKey.length() > 0))
        FlurryAgent.onEndSession(this);
      Log.d("engine", "EngineActivity  onStop - done");
      return;
    }
    catch (Exception localException)
    {
      Error.processException("onStop", localException);
    }
  }

  void reloadProfile()
  {
    runOnGLThread(new Runnable()
    {
      public void run()
      {
        EngineActivity.this.mRenderer.reloadProfile();
      }
    });
  }

  public void removeTickListener(ActivityTickListener paramActivityTickListener)
  {
    try
    {
      synchronized (this.listeners)
      {
        this.listeners.remove(paramActivityTickListener);
        return;
      }
    }
    catch (Exception localException)
    {
      Error.processException("removeListener", localException);
    }
  }

  public void runOnGLThread(Runnable paramRunnable)
  {
    if ((this.mGLSurfaceView == null) || (paramRunnable == null))
      return;
    this.mGLSurfaceView.queueEvent(paramRunnable);
  }

  public void showMessage(String paramString)
  {
    showMessageEx(paramString, new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        paramAnonymousDialogInterface.dismiss();
      }
    }
    , null, new DialogInterface.OnCancelListener()
    {
      public void onCancel(DialogInterface paramAnonymousDialogInterface)
      {
        paramAnonymousDialogInterface.dismiss();
      }
    });
  }

  public void showMessageEx(final String paramString, final DialogInterface.OnClickListener paramOnClickListener1, final DialogInterface.OnClickListener paramOnClickListener2, final DialogInterface.OnCancelListener paramOnCancelListener)
  {
    this.mHandler.post(new Runnable()
    {
      public void run()
      {
        if (EngineActivity.this.isFinishing())
          return;
        AlertDialog.Builder localBuilder = new AlertDialog.Builder(EngineActivity.this);
        localBuilder.setTitle(EngineActivity.this.getString(R.string.app_name)).setMessage(paramString);
        if (paramOnClickListener1 != null)
          localBuilder.setPositiveButton(EngineActivity.this.getResources().getString(R.string.OK), paramOnClickListener1);
        if (paramOnClickListener2 != null)
          localBuilder.setNegativeButton(EngineActivity.this.getResources().getString(R.string.cancel), paramOnClickListener2);
        if (paramOnCancelListener != null)
          localBuilder.setOnCancelListener(paramOnCancelListener);
        localBuilder.create().show();
      }
    });
  }

  protected void showWaitScreen(final boolean paramBoolean)
  {
    runOnUiThread(new Runnable()
    {
      public void run()
      {
        try
        {
          if (paramBoolean)
          {
            EngineActivity.this.mFramelayout.addView(EngineActivity.this.mProgressFramelayout);
            EngineActivity.this.mGLSurfaceView.setEnabled(false);
            return;
          }
          EngineActivity.this.mFramelayout.removeView(EngineActivity.this.mProgressFramelayout);
          EngineActivity.this.mGLSurfaceView.setEnabled(true);
          return;
        }
        catch (Exception localException)
        {
          Error.processException(localException);
        }
      }
    });
  }

  public static abstract interface ActivityTickListener
  {
    public abstract void onBeginTick();

    public abstract void onEndTick();
  }

  class MySSLSocketFactory extends org.apache.http.conn.ssl.SSLSocketFactory
  {
    SSLContext sslContext = SSLContext.getInstance("TLS");

    public MySSLSocketFactory(KeyStore arg2)
      throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
    {
      super();
      this.sslContext.init(null, EngineActivity.mTrustManagers, null);
    }

    public Socket createSocket()
      throws IOException
    {
      return this.sslContext.getSocketFactory().createSocket();
    }

    public Socket createSocket(Socket paramSocket, String paramString, int paramInt, boolean paramBoolean)
      throws IOException, UnknownHostException
    {
      return this.sslContext.getSocketFactory().createSocket(paramSocket, paramString, paramInt, paramBoolean);
    }
  }

  public class SessionStatusCallback
    implements Session.StatusCallback
  {
    private int callback = 0;
    private final boolean mRequestPermissions = false;
    private int userData = 0;

    public SessionStatusCallback(int paramInt1, int arg3)
    {
      this.userData = paramInt1;
      int i;
      this.callback = i;
    }

    public void call(Session paramSession, SessionState paramSessionState, Exception paramException)
    {
      final EngineActivity localEngineActivity;
      try
      {
        Log.d("engine", String.format("SessionStatusCallback(%s, %s, %s)", new Object[] { paramSession, paramSessionState, paramException }));
        localEngineActivity = EngineActivity.getInstance();
        if ((!paramSession.isOpened()) || (paramException != null))
          break label181;
        Log.d("engine", String.format("session.isOpened() && (exception == null)", new Object[0]));
        List localList = paramSession.getPermissions();
        if (!localList.containsAll(FacebookOperations.READ_PERMISSIONS))
        {
          Log.d("facebook", "permissions: " + localList.toString());
          paramSession.requestNewReadPermissions(new Session.NewPermissionsRequest(localEngineActivity, FacebookOperations.READ_PERMISSIONS));
          return;
        }
        if (!localList.containsAll(FacebookOperations.PUBLISH_PERMISSIONS))
        {
          paramSession.requestNewPublishPermissions(new Session.NewPermissionsRequest(localEngineActivity, FacebookOperations.PUBLISH_PERMISSIONS));
          return;
        }
      }
      catch (Exception localException)
      {
        Error.processException("SessionStatusCallback", localException);
        return;
      }
      if (localEngineActivity != null)
      {
        localEngineActivity.runOnGLThread(new Runnable()
        {
          public void run()
          {
            if (!com.melesta.facebook.NativeDelegate.OnLogin(EngineActivity.SessionStatusCallback.this.userData, EngineActivity.SessionStatusCallback.this.callback))
              new Timer("login").schedule(new TimerTask()
              {
                public void run()
                {
                  EngineActivity.SessionStatusCallback.1.this.val$ea.runOnGLThread(jdField_this);
                }
              }
              , 100L);
          }
        });
        return;
        label181: Log.d("engine", "SessionStatusCallback OnLogout");
        if (localEngineActivity != null)
          localEngineActivity.runOnGLThread(new Runnable()
          {
            public void run()
            {
              com.melesta.facebook.NativeDelegate.OnLogout(EngineActivity.SessionStatusCallback.this.userData, EngineActivity.SessionStatusCallback.this.callback);
            }
          });
      }
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.melesta.engine.EngineActivity
 * JD-Core Version:    0.6.2
 */